<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /* 圣杯布局 */
      #container {
        /* 为了把一些位置留给左右两边，将剩下的content给中间的 */
        padding-left: 190px;
        padding-right: 190px;
        background-color: #efefef;
      }
      #container p {
        float: left;
      }
      .center {
        width: 100%;
        text-align: center;
        background-color: lightcoral;
      }
      .left {
        width: 190px;
        position: relative;
        left: -190px;
        margin-left: -100%;
        background-color: lightcyan;
      }
      .right {
        width: 190px;
        /* 为了让右边的元素不占据位置，继续与前面的元素在同一行 */
        margin-right: -190px;
        background-color: lightgreen;
      }
      .clearfix:after {
        content: "";
        display: table;
        clear: both;
      }
    </style>
  </head>
  <body>
    <div id="container" class="clearfix">
      <p class="center">我是中间</p>
      <p class="left">我是左边</p>
      <p class="right">我是右边</p>
    </div>
  </body>
</html>
